#ifndef geometry_h__
#define geometry_h__
#include <graphics/ivertexbuffer.h>
#include <math/vector.h>

namespace gecko
{

	//------------------------------------------------------------------------------------------------

	// forward declare types
	class Vertex;
	class IIndexBuffer;
	class IRenderer;
	struct GeometryBatch;
	class IEffect;
	class Colour;

	//------------------------------------------------------------------------------------------------

	// defines a mesh
	class Geometry
	{
	public:
		// constructor
		Geometry(void);

		// destructor
		virtual ~Geometry(void);

		// initialise and set up index buffer
		void Initialise(Vertex* vertices, short numVertices, unsigned short* indices, short numIndices, IEffect* effect, IVertexBuffer::ePrimitiveType primitiveType);

		// clean up
		void Destroy();

		// get the shader effect
		IEffect* GetEffect();

	#if defined(_DEBUG)
		// get mesh filename (for debugging)
		const char* GetName();
	#endif

		// helper function to create a simple triangle
		void CreateTriangle(const Vector3f& p1, const Vector3f& p2, const Vector3f& p3, const Colour& colour, IEffect* effect);

		short m_numIndices;
		short m_numVertices;

		GeometryBatch* m_batch;
		
		Vertex* m_vertices;
		unsigned short* m_indices;

		IVertexBuffer::ePrimitiveType m_primitiveType;
	
	private:
		// shader effect to render with
		IEffect* m_effect;
	};

	//------------------------------------------------------------------------------------------------

}

#endif // geometry_h__
